package com.weifei.core.aop;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class WFMethodBeforeAdvice extends WFAbstractAspectAdvice implements WFAdvice
, WFMethodInterceptor{

    private WFJointPoint jointPoint;

    public WFMethodBeforeAdvice(Method aspectMethod, Object aspectTarget) {
        super(aspectMethod, aspectTarget);
    }

    public void before(Method method, Object[] args, Object target) throws Throwable {
        invokeAdvice(this.jointPoint, null, null);
    }

    public Object invoke(WFMethodInvocation mi) throws Throwable {
        this.jointPoint = mi;
        this.before(mi.getMethod(), mi.getArguments(), mi.getThis());
        return mi.proceed();
    }

}
